{template 'common/header'}
{template 'common'}
<ul class="nav nav-tabs">
	<li {if $operation == 'display'} class="active" {/if}><a href="{php echo $this->createWebUrl('companyrole',array('op' =>'display'))}">企业套餐列表</a></li>
	<li{if empty($toplist['id']) && $operation == 'post'} class="active" {/if}><a href="{php echo $this->createWebUrl('companyrole',array('op' =>'post'))}">添加企业套餐</a></li>
	{if !empty($toplist['id']) &&  $operation == 'post'}<li  class="active"><a href="{php echo $this->createWebUrl('companyrole',array('op' =>'post','id'=>$adv['id']))}">编辑企业套餐</a></li>{/if}
</ul>

{if $operation == 'display'}






<div class="main">
	<div class="panel panel-info">
	<div class="panel-heading">（将所有企业数据同步到指定等级，请谨慎操作）</div>
	<div class="panel-body">
		<form action="./index.php" method="get" class="form-horizontal" role="form">
			<input type="hidden" name="c" value="site" />
			<input type="hidden" name="a" value="entry" />
			<input type="hidden" name="m" value="weixinmao_zp" />
			<input type="hidden" name="do" value="companyrole" />
			<input type="hidden" name="op" value="updaterole" />
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
				<div class="col-xs-8 col-sm-8 col-lg-9">
<select class="form-control tpl-category-parent we7-select" id="roleid" name="roleid">
				<option value="0">请选择同步等级</option>
				{if $list }
				{loop $list $vo}
				<option value="{$vo['id']}">{$vo['title']}</option>
				{/loop}
				{/if}
				
			</select>					
				</div>
					<div class="col-xs-4 col-sm-2 col-lg-2">
					<button class="btn btn-default"><i class="fa fa-search"></i> 同步所有企业</button>
				</div>
			</div>
		
		</form>
	</div>
</div>




<div class="main panel panel-default">
	<div class="panel-body table-responsive">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th style="width:30px;">ID</th>
					<th>级别</th>	
					 <th>标题</th>				
					<th>金额</th>
					<th>有效天数</th>
					<th>发布职位数</th>
					<th>发布简历数</th>
					<th>企业初始化</th>
					<th>显示</th>
					<th >操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $vo}
				<tr>
					<td>{$vo['id']}</td>
					<td>{$vo['sort']}</td>
					<td>{$vo['title']}</td>
					<td>{$vo['money']}</td>
					<td>{$vo['days']}</td>
					<td>{$vo['jobnum']}</td>
					<td>{$vo['notenum']}</td>
					<td>{if $vo['isinit']==1}
								<span class='label label-success'>是</span>
								{else}
								<span class='label label-danger'>否</span>
								{/if}</td>
					<td>{if $vo['enabled']==1}
								<span class='label label-success'>是</span>
								{else}
								<span class='label label-danger'>否</span>
								{/if}</td>
					<td style="text-align:left;">
						<a href="{php echo $this->createWebUrl('companyrole', array('op' => 'post', 'id' => $vo['id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="修改"><i class="fa fa-edit"></i></a>
						<a href="{php echo $this->createWebUrl('companyrole', array('op' => 'delete', 'id' => $vo['id']))}"class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="删除"><i class="fa fa-times"></i></a>
					</td>
				</tr>
				{/loop}
			</tbody>
		</table>
		{$pager}
	</div>
</div>
<script>
	require(['bootstrap'],function($){
		$('.btn').hover(function(){
			$(this).tooltip('show');
		},function(){
			$(this).tooltip('hide');
		});
	});
</script>
{elseif $operation == 'post'}

<div class="main">
	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" onsubmit='return formcheck()'>
		<input type="hidden" name="id" value="{$toplist['id']}" />
		<div class="panel panel-default">
			<div class="panel-heading">
				企业套餐设置
			</div>
			<div class="panel-body">
					<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>级别</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="sort" class="form-control" value="{$toplist['sort']}" />数字越大级别越高
					</div>
				</div>

					<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>标题</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id='title' name="title" class="form-control" value="{$toplist['title']}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>金额</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id='money' name="money" class="form-control" value="{$toplist['money']}" />
					</div>
				</div>
					<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>发布职位数</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id='jobnum' name="jobnum" class="form-control" value="{$toplist['jobnum']}" />
					</div>
				</div>
					<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>发布简历数</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id='notenum' name="notenum" class="form-control" value="{$toplist['notenum']}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>有效天数</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id='days' name="days" class="form-control" value="{$toplist['days']}" />
					</div>
				</div>
			
			
			  <div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否企业初始化</label>
					<div class="col-sm-9 col-xs-12">
						<label class='radio-inline'>
							<input type='radio' name='isinit' value=1' {if $toplist['isinit']==1}checked{/if} /> 是
						</label>
						<label class='radio-inline'>
							<input type='radio' name='isinit' value=0' {if $toplist['isinit']==0}checked{/if} /> 否
						</label>
					</div>
				</div>
			
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否显示</label>
					<div class="col-sm-9 col-xs-12">
						<label class='radio-inline'>
							<input type='radio' name='enabled' value=1' {if $toplist['enabled']==1}checked{/if} /> 是
						</label>
						<label class='radio-inline'>
							<input type='radio' name='enabled' value=0' {if $toplist['enabled']==0}checked{/if} /> 否
						</label>
					</div>
				</div>
			</div>
		</div>
<div class="form-group col-sm-12">
	<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
	<input type="hidden" name="token" value="{$_W['token']}" />
	</div>
	</form>
</div>

<script language='javascript'>
	function formcheck() {
		if ($("#title").isEmpty()) {
			Tip.focus("title", "请填写标题!");
			return false;
		}
		if ($("#money").isEmpty()) {
			Tip.focus("money", "请填写金额!");
			return false;
		}
		if($("#days").isEmpty() )
			{
			   Tip.focus("days", "请填写次数");
				return false;
			}
		return true;
	}
</script>
{/if}
{template 'common/footer'}